import {MEMBER} from '../type';
import {createReducer} from '../'


const initialState = {
    userList: [],  // 会员列表
    couponList: [],  // 优惠券列表
    avatarFile:'',
    balanceList:[],//充值列表
    userDetail:'',//用户信息
};

const actionHandler = {
    [MEMBER.USER_LIST]: (state, action) => {
        return {
            ...state,
            userList: action.res
        }
    },
    [MEMBER.COUPON_LIST]: (state, action) => {
        return {
            ...state,
            couponList: action.res
        }
    },
    [MEMBER.AVATAR_FILE]: (state, action) => {
        return {
            ...state,
            avatarFile: action.res
        }
    },
    [MEMBER.BALANCE_LIST]: (state, action) => {
        return {
            ...state,
            balanceList: action.res
        }
    },
    [MEMBER.USER_DETAIL]: (state, action) => {
        return {
            ...state,
            userDetail: action.res
        }
    }
};

export default createReducer(initialState, actionHandler)